<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:550px;">
			<div data-options="region:'north'" style="height:90px;">
				<div id="p" class="easyui-panel" title="查询" style="width:100%;height:100%;padding:15px;">
					<table cellspacing="4">
						<tr>
							<td>用户组</td>
							<td><input class="easyui-combobox" name="CUSTOMER_TYPE" id="search_area" placeholder="请输入需要查询的用户组" data-options="panelHeight:'100px'" /></td>
							<td>配送单位</td>
							<td><input class="easyui-textbox" name="CUSTOMER_NAME" id="search_customr_name" placeholder="请输入需要查询的订货单位" data-options="panelHeight:'100px'" /></td>
							<!--<td>状态</td>
							<td>
								<input id="search_state" class="easyui-combobox" data-options="panelHeight:'100px',url:RemoteLinkAddress+'/logistics/originalorder/getstate.do',mode:'remote',method:'get',valueField:'STATE',textField:'STATE'" />
							</td>-->
							<td>配送时间</td>
							<td><input class="easyui-datebox" name="DISTRIBUTION_DATE" id="search_begin_time" placeholder="请输入需要查询的配送时间" /></td>
							<!--<td>配送结束时间</td>
							<td><input class="easyui-datebox" id="search_end_time" placeholder="请输入需要查询的配送时间" /></td>-->
							<td>
								<a href="#" class="easyui-linkbutton" onclick="doSearch()" data-options="iconCls:'icon-search'" style="width:80px;">查询</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div data-options="region:'center'">
				<div id="p" class="easyui-panel" style="width:100%;height:100%;padding:0px;">
					<div class="easyui-tabs" id="div_tabs" style="width: 100%;">
						<div title="网络订单列表" style="overflow:hidden">
							<iframe id="ifrmList" style="width: 100%;height: 350px;" frameborder="0" scrolling="no"></iframe>
						</div>
						<!--<div title="原始订单汇总信息" style="overflow:hidden">
							<iframe id="ifrmInfo" src="OriginalOrderSum.html" style="width: 100%;height: 100%;" frameborder="0" scrolling="no"></iframe>
						</div>-->
					</div>
				</div>
			</div>
		</div>

	</body>
	<script type="text/javascript">
		var id = getID();
		var localAdre = "webdata";
		var WebData = new Array();
		var currCustomerType="";
		var searchResult;//保存查询结果
		getAllData();
		$("#ifrmList").attr("src", "WebOrderList.html?id=" + id);
		$('#search_area').combobox({
			valueField: 'CUSTOMER_TYPE',
			textField: 'CUSTOMER_TYPE',
			panelHeight: 'auto',
			mode: 'remote',
			method: 'get',
			url: RemoteLinkAddress + "/logistics/customertype/listall.do",
			onSelect:function(record)
			{
				var _url="";
				_url=RemoteLinkAddress + '/logistics/customer/listall.do?CUSTOMER_TYPE='+record.CUSTOMER_TYPE;
				$('#search_customr_name').combobox("reload",_url);
			}
		});
		$('#search_customr_name').combobox({
			valueField: 'CUSTOMER_NAME',
			textField: 'CUSTOMER_NAME',
			panelHeight: 200,
			mode: 'remote',
			method: 'get',
			url: RemoteLinkAddress + '/logistics/customer/listall.do',
			onChange: function(newValue, oldValue) {
				if(newValue != "" && newValue != undefined) {
					var url = RemoteLinkAddress + "/logistics/customer/findbypinyin?PINYINFIELDNAME=" + newValue.trim();
					$(this).combobox("reload", url);
				}
			}
		});
		function getAllData() {
			var WebDataObject = {};
			var _localData=localStorage.getItem(localAdre);
			if(_localData!=null && _localData!="")
			{
				WebDataObject = JSON.parse(_localData);
			}
			for(var s in WebDataObject){
				WebData =WebData.concat(WebDataObject[s].rows);
			}
			searchResult=WebData;
			localStorage.setItem("WebSearchData",JSON.stringify(WebData));
		}
		function doSearch() {
			var allData = WebData;
			var _localData;
			var areaWord = $("#search_area").combobox('getValue');//用户组
			var customernameWord = $("#search_customr_name").textbox('getValue');//配送单位名称
			var begintimeWord = $("#search_begin_time").datebox('getValue');//开始配送时间
			if(areaWord.trim() != ""){
				allData = searchData(allData,areaWord.trim(),"CUSTOMER_TYPE");
			}if(customernameWord.trim() != ""){
				allData = searchData(allData,customernameWord.trim(),"CUSTOMER_NAME");
			}if(begintimeWord.trim() != ""){
				allData =searchData(allData,begintimeWord.trim(),"DISTRIBUTION_DATE");
			}
			searchResult = allData;
			_localData=localStorage.getItem("WebSearchData");
			if(_localData!=null){
				localStorage.removeItem("WebSearchData");
			}
			localStorage.setItem("WebSearchData",JSON.stringify(allData));
			$("#ifrmList").attr("src", "WebOrderList.html?id=" + id);
		}
		
		function returnSearchData(){
			return searchResult;
		}
		
		function searchData(arr,keyword,name){
			var contArr = new Array();
			var _this;
			for(var i = 0,len = arr.length; i < len;i++){
				_this = arr[i];
				if(_this[name] === keyword){
					contArr = contArr.concat(_this);
				}
			}
			return contArr;
		}
	</script>

</html>